package hotel.quartz.oversea.job.meituan;

import com.alibaba.fastjson.JSON;
import hotel.base.oversea.constant.CallbackConstants;
import hotel.base.oversea.constant.CommonConstants;
import hotel.base.oversea.constant.CommonUrlConstants;
import hotel.base.oversea.constant.MeituanConstants;
import hotel.base.oversea.constant.enums.MessageEnums;
import hotel.base.oversea.constant.quartz.UrlSwitchsEnums;
import hotel.base.oversea.utils.*;
import hotel.quartz.oversea.config.service.RedisService;
import hotel.quartz.oversea.entity.form.JobForm;
import hotel.quartz.oversea.job.base.BaseJob;
import hotel.quartz.oversea.service.JobAndTriggerService;
import hotel.quartz.oversea.util.JobRestTemplateUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;

import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;

/**
 * 节点时间主动查询上架酒店产品价格 - 价格日历接口
 *
 *
 * @description: Part Time Query Check Price Job
 * @author: qiuyy
 * @date: 2020-05-26 13:22
 * @version: V1.0
 */
@Slf4j
public class PartTimeQueryCheckPriceJob implements BaseJob {
    private String timestamp = "Ptqcpj"+String.valueOf(System.currentTimeMillis())+ StringUtil.getFourRandom();

    private String jobGroupName = MeituanConstants.JOB_GROUP_NAME_MT;
    private String jobClassName = this.getClass().getName();

    @Autowired
    private JobAndTriggerService jobAndTriggerService;

    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private RedisService redisService;


    /**
     * 用途: 主动查询（美团接口不包含endDate 包含startDate）  不减一
     * @return
     */
    public Integer getDaysCommonBaseSet() {
        Integer returnDays;
        String daysCom = (String)redisService.get(CallbackConstants.SWMT_PRICE_STATUS_DAYS);
        if(ObjectUtils.isEmpty(daysCom)){
            Result result = RestTemplateUtils.get(CommonUrlConstants.ADMIN_HOST+"/sysCommonBase/getLikeId?id="+ CallbackConstants.SWMT_PRICE_STATUS_DAYS,null,restTemplate);
            if(result.getCode() == CommonConstants.SUCCESS && !ObjectUtils.isEmpty(result.getData())){
                daysCom = (String)result.getData();
                redisService.set(CallbackConstants.SWMT_PRICE_STATUS_DAYS,daysCom);
                returnDays = Integer.valueOf(daysCom);
            }else{
                SendUtils.dingMsgNotLog("获取基础配置days异常请排查", DateUtil.getCurrTime()+" 当前设置默认值价格房态查询3天 result="+ GsonUtils.GsonString(result), MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                returnDays = 3;//有异常默认3天并推送钉钉
            }
        }else{
            returnDays = Integer.valueOf(daysCom);
        }

        return returnDays;

    }
    @Override
    @SneakyThrows
    public void execute(JobExecutionContext jobExecutionContext) {
        /**
         * qyy 20210311
         * 1、主动查询价格0-2点关闭，异步价格全天候开启；
         *    主动房态定时器全天候开启，异步房态0-2点关闭；
         * 2、0-2点不载入新一天价格房态
         *
         * 【异步】
         *  mtsw_job_price_not_todo_at_time--》 value = "00,01" --> 主动查询价格0-2点关闭
         */

        log.info("Part Time Query Check Price Job {} >>>>>>>> 节点时间主动查询上架酒店产品价格定时器 执行时间: {}", timestamp, DateUtil.getCurrTime());

        String thisHourStr = null;
        String notTodoAtTimeHour = null;
        if(null != redisService.get("mtsw_job_price_not_todo_at_time")){//value="23,00,01"
            notTodoAtTimeHour = (String)redisService.get("mtsw_job_price_not_todo_at_time");
            thisHourStr = DateUtil.formatDate(new Date(),"HH");
        }
        if(!ObjectUtils.isEmpty(notTodoAtTimeHour) && notTodoAtTimeHour.contains(thisHourStr)){
            if(thisHourStr.equals("23")){
                int min= Calendar.getInstance().get(Calendar.MINUTE);
                if(BigDecimal.valueOf(Integer.valueOf(min)).compareTo(BigDecimal.valueOf(50))>0){
                    log.info("Part Time Query Check Price Job {} >>>>>>>> 节点时间主动查询上架酒店产品价格定时器 thisHourStr={},当前跳过不执行notTodoAtTimeHour={}", timestamp,thisHourStr,notTodoAtTimeHour);
                    if(null == redisService.get("mtsw_send_not_todo_price_job")){
                        SendUtils.dingMsgNotLog("[SW-JOB-PRICE-AT-TIME]指定时间段不执行-价格定时器", DateUtil.getCurrTime()+" notTodoAtTimeHour="+notTodoAtTimeHour, MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                        redisService.setUnit("mtsw_send_not_todo_price_job",1,2L,TimeUnit.HOURS);
                    }
                    return;
                }
            }else{
                log.info("Part Time Query Check Price Job {} >>>>>>>> 节点时间主动查询上架酒店产品价格定时器 当前跳过不执行notTodoAtTimeHour={}", timestamp,notTodoAtTimeHour);
                if(null == redisService.get("mtsw_send_not_todo_price_job")){
                    SendUtils.dingMsgNotLog("[SW-JOB-PRICE-AT-TIME]指定时间段不执行-价格定时器", DateUtil.getCurrTime()+" notTodoAtTimeHour="+notTodoAtTimeHour, MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                    redisService.setUnit("mtsw_send_not_todo_price_job",1,2L,TimeUnit.HOURS);
                }
                return;
            }
        }


        //从缓存中获取上架的酒店
        Long hotelQueueSize = redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE);

        Integer max = 500;
        if(null != redisService.get("PartTimeQueryCheckPriceJob_max")){
            max = (Integer)redisService.get("PartTimeQueryCheckPriceJob_max");
        }
        if(hotelQueueSize>max){
            log.info("timestamp={} 主动查询价格定时器，hotelQueueSize堆积超过 hotelQueueSize={}",timestamp,hotelQueueSize);
            if(null != redisService.get("PartTimeQueryCheckPriceJob_wait_req") && redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL)>100){
                log.error("PartTimeQueryCheckPriceJob程序判断携程队列堆积超过100,当前批次主动查询不发起执行，待查询美团酒店队列size="+hotelQueueSize+" 携程队列size="+redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL));
                SendUtils.dingMsg("定时器-主动价格-PASS", DateUtil.getCurrTime()+" 程序判断携程队列堆积超过100,当前批次主动查询不发起执行，待查询美团酒店队列size="+hotelQueueSize+" 携程队列size="+redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL), MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                return;
            }else{
                try {
                    Thread.sleep(5000);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
                Long newSize = redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE);
                if(BigDecimal.valueOf(hotelQueueSize).compareTo(BigDecimal.valueOf(newSize))==0){
                    if(null == redisService.get("PartTimeQueryCheckPriceJob_wait_ing")){
                        log.info("PartTimeQueryCheckPriceJob暂停3秒后队列数量还是一样则当前次定时器要执行，并不存在上一次线程还在跑");
                        log.info("主动查询价格定时器，hotelQueueSize堆积超过："+hotelQueueSize);
                        SendUtils.dingMsg("定时器-主动价格", DateUtil.getCurrTime()+" 当前继续执行，判断没有上一次线程，但存在待处理酒店size="+hotelQueueSize, MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                    }else{
                        SendUtils.dingMsg("定时器-主动价格-PASS", DateUtil.getCurrTime()+" 存在上一次执行程序未结束，countSleep不等于空，当前跳过该批次定时器，size="+hotelQueueSize, MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                        return;
                    }
                }else{
                    SendUtils.dingMsg("定时器-主动价格-PASS", DateUtil.getCurrTime()+" 存在上一次执行程序未结束，当前跳过该批次定时器，size="+hotelQueueSize, MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                    return;
                }
            }
        }

        if(hotelQueueSize<=0){

            log.info("Part Time Query Check Price Job  {} hotelQueueSize  当前队列size=0，重新获取缓存上架酒店，首轮重新跑批",timestamp, DateUtil.getCurrTime());
            //重置该表示待查询的酒店ids,,opsForList() 每拿出一个hotelID就会集合中剔除一个
            List<Integer> ids = findAscUpMtHotelId();
            if(null != ids && ids.size()>0){
                for (Integer hotelId:ids){
                    redisService.lPush(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE,hotelId);
                }
                hotelQueueSize = Long.valueOf(ids.size());
            }else{
                log.error("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器,redis中无售卖房型的美团酒店id数据，该次定时器主动更新价格推送跳过",timestamp);
            }
        }
        log.error("Part Time Query Check Price Job {} 当前获取到 剩余待查询酒店 hotelQueueSize：{}",timestamp,hotelQueueSize);

        if(hotelQueueSize>0){
            beforeRequest();
        }else{
            //redisService.remove("doing_PartTimeQueryCheckPriceJob");
        }
        log.info("Part Time Query Check Price Job {} >>>>>>>> 节点时间主动查询上架酒店产品价格定时器 结束时间: {},{}",timestamp, DateUtil.getCurrTime());

    }

    private List<Integer> findAscUpMtHotelId() {

        String switchHost = CommonUrlConstants.SWITCHS_ONLINE_HOST;
        String getUpMtHotel = switchHost+ UrlSwitchsEnums.checkFindPriceStatus.GET_UP_MT_HOTEL.getValue();//查询所有
        log.info("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器 进入方法 findAscUpMtHotelId",timestamp);
        //发起请求
        Map params = new HashMap();
        params.put("timestamp",timestamp);//每次定时器调用接口传唯一timestamp，为了方便查询线程日志
        Result response = JobRestTemplateUtils.post(getUpMtHotel, JSON.toJSONString(params),restTemplate);
        log.info("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器 进入方法 findAscUpMtHotelId 接口返回 res={}",timestamp, GsonUtils.GsonString(response));
        if(response.getCode()== CommonConstants.SUCCESS){
            List<Integer> list = GsonUtils.jsonToList(response.getData().toString(),Integer.class);
            log.info("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器 重新调用接口获取上架酒店list={}",timestamp, GsonUtils.GsonString(list));
            return list;
        }
        return null;
    }

    private Integer beforeRequest() {


        Long hotelQueueSize = redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE);

        int countTask = MeituanConstants.PART_PRICE_TIME_TASK_COUNT;
        if(null != redisService.get("PartTimeQueryCheckPriceJob_count_task")){
            countTask = (Integer) redisService.get("PartTimeQueryCheckPriceJob_count_task");
        }
        Integer sleeptime = 1000;
        if(null != redisService.get("PartTimeQueryCheckPriceJob_sleeptime_sec")){
            sleeptime = (Integer) redisService.get("PartTimeQueryCheckPriceJob_sleeptime_sec");
            //2000 * 10  让task间隔20秒调一次，由于携程处理不过来，队列堆积太多，不然后面的异步通知都只能延迟处理
            //每调用一次美团方法，方法内部发起8个线程，1个线程涉及10个酒店，则总共处理80个酒店，则追加队列数据为80条。  每间隔14秒80条
            //携程是2秒处理8条左右，则20秒处理80个队列左右
        }
        Long min = 1L;
        Integer countHotel = MeituanConstants.PART_PRICE_TIME_HOTEL_COUNT;//每次上送一家酒店
        if(hotelQueueSize/(countTask*countHotel)>0){
            //min = hotelQueueSize/(countTask*countHotel)*(sleeptime/1000)/60;
            min=hotelQueueSize/3500+5;
            min = min*3;
        }


        log.info("Part Time Query Check Price Job 存在上架酒店 size={},缓存失效时间min={},sleeptime={}",hotelQueueSize,min,sleeptime);
        long count = hotelQueueSize/(countHotel*countTask)+10;

        log.info("hotelQueueSize count={}",count);
        doCheckReq(1,count,sleeptime);
        Long hotelQueueSize2 = redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE);
        if(hotelQueueSize2>0){
            log.info("Part Time Query Check Price Job 判断存在还有酒店，进入第二次处理 hotelQueueSize2={}",hotelQueueSize2);
            long count2 = hotelQueueSize2/(countHotel*countTask)+10;
            doCheckReq(2,count2,sleeptime);
        }
        return 1;
    }

    private void doCheckReq(Integer flag,Long count,Integer sleeptime) {
        if(null != redisService.get("PartTimeQueryCheckPriceJob_stop")){
            log.info("PartTimeQueryCheckPriceJob 主动查询价格停止定时器for flag={}",flag);
            return;
        }
        for (int i = 0; i <= count; i++) {
            if(null != redisService.get("PartTimeQueryCheckPriceJob_sleeptime_sec")){
                sleeptime = (Integer) redisService.get("PartTimeQueryCheckPriceJob_sleeptime_sec");
                //2000 * 10  让task间隔20秒调一次，由于携程处理不过来，队列堆积太多，不然后面的异步通知都只能延迟处理
                //每调用一次美团方法，方法内部发起8个线程，1个线程涉及10个酒店，则总共处理80个酒店，则追加队列数据为80条。  每间隔14秒80条
                //携程是2秒处理8条左右，则20秒处理80个队列左右
            }
            log.info("PartTimeQueryCheckPriceJob hotelQueueSize 调用美团方法i={},调用前 hotel队列size={},该size不代表真实因为异步线程在实时处理中 flag={}",i,redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE),flag);

            String callbackHost = CommonUrlConstants.CALLBACK_HOST;//初始默认网关防止有问题走网关保险
            /*if(null != redisService.get(CommonConstants.SW_CHANGE_HOST_GATEWAY)){
                //切换至网关
            }else{
                //目前都走内网
                if(i%2==0){
                    callbackHost = CommonUrlConstants.SW_STATUS_PRICE_JOB_2;
                }else{
                    callbackHost = CommonUrlConstants.SW_STATUS_PRICE_JOB_1;
                }
            }*/
            req(1,callbackHost);

            if(redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE)==0){
                log.info("Part Time Query Check Price Job 缓存的酒店为0 break flag={}",flag);
                break;
            }
            try {
                Thread.sleep(sleeptime);
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
            if(null != redisService.get("PartTimeQueryCheckPriceJob_stop")){
                log.info("PartTimeQueryCheckPriceJob 主动查询价格停止定时器for flag={}",flag);
                break;
            }

        }
    }

    /**
     * 该方法包含关闭异步通道：该方式和零点方案不冲突：方案：异步价格全天候，主动查询0-2关闭--》关闭异步通道只会在主动查询中操作，不影响。
     * @param count
     * @param callbackHost
     * @return
     */
    private Integer req(Integer count,String callbackHost){
        if(count>100){
            request(callbackHost);
            return 1;
        }
        Integer max = 100;
        if(null != redisService.get("sw_query_max_wait_count")){
            max = (Integer) redisService.get("sw_time_query_max_wait_count");
        }
        if(redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL)>max){
            checkDelaySizeOpenAstrict(count);
            log.info("主动查询价格判断到携程队列中待消费大于100，当前延迟发起 count={}",count);
            redisService.setUnit("PartTimeQueryCheckPriceJob_wait_req",1,6L,TimeUnit.SECONDS);
            try {
                redisService.setUnit("PartTimeQueryCheckPriceJob_wait_ing",1,4L,TimeUnit.SECONDS);
                Thread.sleep(2000);
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
            return req(count+1,callbackHost);
        }else{
            request(callbackHost);
        }
        if(count==1){
            try {
                Thread.sleep(2);//线程也可能并发
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
        return 1;

    }



    /**
     * 调用美团接口    主动查询上送的酒店是否存在变动数据，有则接口中操作存入缓存队列
     *
     * @return
     */
    private void request(String callbackHost) {
        //String callbackHost = CommonUrlConstants.CALLBACK_HOST;
        String checkGetChangeGoodsByOneHotelUrl = callbackHost+ UrlSwitchsEnums.goodsPrice.JOB_QUERY_MT_PRICE_PART_TIME.getValue();
        log.info("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器 进入方法 request",timestamp);
        //发起请求
        Map params = new HashMap();
        params.put("timestamp",timestamp);//每次定时器调用接口传唯一timestamp，为了方便查询线程日志
        params.put("days",getDaysCommonBaseSet());
        long size = redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE);
        log.info("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器  调用携程接口前，缓存酒店队列size={}",timestamp,size);
        Result response = JobRestTemplateUtils.post(checkGetChangeGoodsByOneHotelUrl, JSON.toJSONString(params),restTemplate);
        if(response.getCode()== CommonConstants.SUCCESS){
        }else{
            //还原
            //redisService.lPush(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE,String.valueOf(hotelId));
            log.error("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器进入方法 request 返回失败：{},{}",timestamp, JSON.toJSONString(response), JSON.toJSONString(params));
        }
        long size2 = redisService.queueSize(MeituanConstants.REIDS_POP_ALL_SALE_ROOM_ABOUT_MT_HOTEL_IDS_FOR_RLPRICE);
        log.info("Part Time Query Check Price Job {} 节点时间主动查询上架酒店产品价格定时器  调用携程接口结束，缓存酒店队列size={}",timestamp,size2);
    }
    public void cronJob(String cron,String doTime){
        //已最后一页，暂停定时器,删除rediskey
        JobForm jobForm = new JobForm();
        jobForm.setJobClassName(jobClassName);
        jobForm.setJobGroupName(jobGroupName);
        jobForm.setCronExpression(cron);
        try {
            jobAndTriggerService.cronJob(jobForm);
            log.info("Part Time Query Check Price Job 程序触发n"+doTime+"秒后继续执行");
        } catch (Exception e) {
            log.error("Part Time Query Check Price Job {} 执行cronJob异常: {}",timestamp,jobForm);
            log.error(e.getMessage(),e);
            try {
                Thread.sleep(5000);
                log.error("Part Time Query Check Price Job {} 再次执行cronJob",timestamp);
                jobAndTriggerService.cronJob(jobForm);
            } catch (Exception e2) {
                log.error(e2.getMessage(), e2);
                SendUtils.dingMsg("【异步处理美团房态定时器出现异常，请核实！】", e2.getMessage(),99,restTemplate);
            }
        }
    }

    public void checkDelaySizeOpenAstrict(Integer count){
        if(null == redisService.get("vsec_swmt_queue_max_check_close")){
            if(null == redisService.get(CallbackConstants.CLOSE_MT_CB_PRICE)){
                //方案 1 直接关闭异步通道 半小时
                //方案 2  开启限制（1 只推送涨价 2 携程关房美团开房不推送）
                if(null == redisService.get("swmt_check_gt_price_hour_not")){
                    Integer delayMax1 = 200;
                    if(null != redisService.get("vsec_swmt_sw_delay_max_defined_1")){
                        delayMax1 = (Integer)redisService.get("vsec_swmt_sw_delay_max_defined_1");
                    }
                    //////////限制1- 涨价+不可预订 开启限制
                    if(new BigDecimal(redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL)).compareTo(new BigDecimal(delayMax1))>0){
                        log.info("pricejob主动关闭异步通道价格判断"+ MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL+"大于："+delayMax1+"",count);
                        Long time  = 5L;
                        if(null != redisService.get("close_mt_cb_price_version_1_open_time_expire")){
                            time  = Long.valueOf((Integer)redisService.get("close_mt_cb_price_version_1_open_time_expire"));
                        }
                        redisService.setUnit("swmt_check_gt_price_hour_not","00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23",time,TimeUnit.MINUTES);//只推送涨价
                        redisService.setUnit("swmt_before_not_now_can_no_push_in_hour","00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23",time,TimeUnit.MINUTES);//携程关房美团开房不推送
                        log.info("pricejob 限制1 携程size={}，max{}",redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL),delayMax1);
                    }
                }

                //////////限制2-关闭价格异步通道
                Integer swDelayMax = CallbackConstants.REDIS_SW_QUEUE_CLOSE_PRICE_MAX;//二线比较差 max=2000
                if(null != redisService.get("vsec_swmt_sw_delay_max_defined")){
                    swDelayMax = (Integer)redisService.get("vsec_swmt_sw_delay_max_defined");
                }
                if(new BigDecimal(redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL)).compareTo(new BigDecimal(swDelayMax))>0){
                    log.info("pricejob 限制222 携程size={}，max{}",redisService.queueSize(MeituanConstants.REDIS_CHANGE_GOODS_DATA_MANY_HOTEL),swDelayMax);
                    Long time  = 10L;
                    if(null != redisService.get("close_mt_cb_price_version_2_open_time_expire")){
                        time  = Long.valueOf((Integer)redisService.get("close_mt_cb_price_version_2_open_time_expire"));
                    }
                    SendUtils.dingMsgNotLog("[SW-QUEUE-MAX]主动查询执行中携程队列堆积超："+swDelayMax+" ", DateUtil.getCurrTime()+" 当前将关闭异步价格"+time+"分钟", MessageEnums.genre.GOODS_STATUS_AND_PRICE.getCode(),restTemplate);
                    redisService.setUnit(CallbackConstants.CLOSE_MT_CB_PRICE,1,time,TimeUnit.MINUTES);//出现堆积情况，进入判断，当数据堆积数据>=4800程序将会主动关闭半小时异步价格推送
                }
            }
        }

    }

}
